package net.openvision.util.parsing;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import net.openvision.util.parsing.interfaces.Token;

public class TokenString {
	private List<Token> tokens;
	
	public TokenString() {
		tokens = new ArrayList<Token>();
	}
	
	public TokenString(TokenString copy) {
		this();
		Collections.copy(tokens, copy.tokens);
	}
	
	public TokenString(TokenReader input) throws IOException {
		Token t = input.readToken();
		while (t != null) {
			append(t);
			input.readToken();
		}
	}
	
	public Token get(int index) {
		return tokens.get(index);
	}
	
	public void append(Token t) {
		tokens.add(t);
	}
}
